﻿Chenxin.UI.ShowInfo = Chenxin.extend(Chenxin.UI.PageCommon, {
    autoInitForm: false,
    actionUrl: 'service/housemgr.ashx',
    /**
    *@description 右边标签点击事件
    */
    bindRightBar: function(obj) {
        switch (obj.name) {
            case 'edithouseinfo': //修改房源
                this.form.permitParam = { model: this.modelInfo.toString() };
                this.currentId = $("#ctl00_main_hidHouseId").val(); //房源ID
                this.edit();
                this.form.setTitle('编辑房源');
                break;
            case 'selcustomerinfo': //查询业主
                this.showSelcustomerForm();
                break;
            case 'editcustomerinfo': //修改业主
                this.showEditcustomerForm();
                break;
            case 'addhousetrace': //房源跟盘
                this.showTraceWin();
                break;
            case 'record': //房源备案
                this.showRecordWin();
                break;
            case 'task': //任务分配
                this.showTaskWin();
                break;
            case 'adjourn': //房源封盘
                this.showAdjournWin();
                break;
            case 'addcompareHouse': //加入对比
                this.addcompareHouse('add');
                break;
            case 'addfavors': //加入收藏
                this.addfavors();
                break;
            case 'addprotection': //电话保护
                this.showProtectionWin();
                break;
            case 'unprotection': //取消保护
                this.unProtection();
                break;
            case 'addkey': //添加钥匙
                this.showKeyWin();
                break;
            case 'uploadPic': //上传图片
                this.showUploadHousePic();
                break;
            case 'changeconfirmation': //变更确认
                this.showChangeConfirm();
                break;
        }
    },
    loadmodelInfo: function() {
        var _this = this;
			Chenxin.ajax({
			type: "get",
			dataType: "text",
            paramType: 'json',
			async:false,
			url: 'service/housemgr.ashx',
			data: {op:'gethouseinfo',houseid: $("#ctl00_main_hidHouseId").val()},
			onSuccess: function(data) {
				if (data) {
					_this.modelInfo = data.houseinfo;
				}
			}	
		});
    },
    createGrid: function() {
        var strUrl = "service/paginatioin.ashx";
        //跟单
        var ShowGenDan = new Chenxin.UI.Pagination({
            actionUrl: "service/traceHandler.ashx?op=gethousetrace&houseid=" + $("#ctl00_main_hidHouseId").val(),
            id: 'ShowGenDan',
            renderTo: 'GenDan_table',
            pageSize: 10,
            data: {}
        });
        //委托
        var ShowWeiTou = new Chenxin.UI.Pagination({
            actionUrl: "service/trustHandler.ashx?op=gettrustlist&houseid=" + $("#ctl00_main_hidHouseId").val(),
            id: 'ShowWeiTou',
            renderTo: 'WeiTou_table',
            pageSize: 10,
            data: {}
        });
        //备案
        var ShowBeiAn = new Chenxin.UI.Pagination({
            actionUrl: "service/markedHandler.ashx?op=getmarkedlist&houseid=" + $("#ctl00_main_hidHouseId").val(),
            id: 'ShowBeiAn',
            renderTo: 'BeiAn_table',
            pageSize: 10,
            data: {}
        });
        //钥匙
        var ShowYaoShi = new Chenxin.UI.Pagination({
            actionUrl: "service/keyAddHandler.ashx?op=getkeylist&houseid=" + $("#ctl00_main_hidHouseId").val(),
            id: 'ShowYaoShi',
            renderTo: 'YaoShi_table',
            pageSize: 10,
            data: {}
        });
        //分配
        var ShowFenPei = new Chenxin.UI.Pagination({
            actionUrl: "service/TaskDispenseInfo.ashx?op=gethousetasklist&houseid=" + $("#ctl00_main_hidHouseId").val(),
            id: 'ShowFenPei',
            renderTo: 'FenPei_table',
            pageSize: 10,
            data: {}
        });
        //请求
        var ShowFenPei = new Chenxin.UI.Pagination({
            actionUrl: "service/confirmRequestChange.ashx?op=getrequestlist&houseid=" + $("#ctl00_main_hidHouseId").val(),
            id: 'request',
            renderTo: 'request_table',
            pageSize: 10,
            data: {}
        });


        return ShowGenDan;
    },
    /**
    *创建表单
    */
    createForm: function() {
        //创建修改房源Form表单
        return new Chenxin.UI.HouseBaseInfoForm({
            scope: this,
            autoInit: true
        });
    },
    initEvent: function() {
        var _this = this;
        $('#viewhouseowner').live('click', function() {
            _this.showSelcustomerForm();
        });
        //右边按钮点击事件
        $('.tool_box a').click(function() {
            _this.bindRightBar(this);
        });

        _this.loadmodelInfo();
    },

    /**
    *@description 查询业主
    */
    showSelcustomerForm: function() {
        var _this = this;
        if (!this.HouseCustomerForm) {
            this.HouseCustomerForm = new Chenxin.UI.HouseCustomerForm({
                scope: this,
                alwaysCheckPermit: true,
                beforeFitData: function(model) {
                    var _data = {};
                    _data.Community = $("#ctl00_main_hidCommunity").val();
                    _data.BuildingName = $("#ctl00_main_hidBuildingName").val();
                    _data.Room = $("#ctl00_main_hidRoom").val(); //小区地址
                    _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
                    _data.OprPerson = $("#ctl00_main_lbBroker").text(); //所属人
                    _data.OprDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
                    _data.HouseId = $("#ctl00_main_hidHouseId").val();
                    _this.HouseCustomerForm.currentHouseInfo = _data;
                }
            });
        }
        this.HouseCustomerForm.op = 'view';
        if (this.HouseCustomerForm.show(this.HouseCustomerForm.op, { modelid: $("#ctl00_main_hidCustomerId").val() })) {
            this.getModel($("#ctl00_main_hidHouseId").val(), this.HouseCustomerForm.fitData, this.HouseCustomerForm, 'service/CustomerMgrWithRegion.ashx', 'getmodel', { flg: 'house' });
            this.HouseCustomerForm.setDisable();
            this.HouseCustomerForm.setTitle('查询业主');
        }
    },
    /**
    *@description 修改业主
    */
    showEditcustomerForm: function() {
        var _this = this;
        if (!this.HouseCustomerForm) {
            this.HouseCustomerForm = new Chenxin.UI.HouseCustomerForm({
                scope: this,
                alwaysCheckPermit: true,
                beforeFitData: function(model) {
                    var _data = {};
                    _data.Community = $("#ctl00_main_hidCommunity").val();
                    _data.BuildingName = $("#ctl00_main_hidBuildingName").val();
                    _data.Room = $("#ctl00_main_hidRoom").val();
                    _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
                    _data.OprPerson = $("#ctl00_main_lbBroker").text(); //所属人
                    _data.OprDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
                    _data.HouseId = $("#ctl00_main_hidHouseId").val();
                    _this.HouseCustomerForm.currentHouseInfo = _data;
                }
            });
        }

        this.HouseCustomerForm.op = 'edit';
        if (this.HouseCustomerForm.show(this.HouseCustomerForm.op, { currentId: $("#ctl00_main_hidCustomerId").val() })) {
            // Chenxin.Fn.getModel($("#ctl00_main_hidCustomerId").val(), this.HouseCustomerForm.actionUrl, this.HouseCustomerForm.fitData, this.HouseCustomerForm);
            this.getModel($("#ctl00_main_hidHouseId").val(), this.HouseCustomerForm.fitData, this.HouseCustomerForm, 'service/CustomerMgr.ashx', 'getmodel', { flg: 'house' });
            this.HouseCustomerForm.setEnable();
            this.HouseCustomerForm.setTitle('修改业主');
        }
    },
    /**
    *@description 请求变更/变更确认
    */
    showChangeConfirm: function() {
        var _this = this;
        this.currentId = $("#ctl00_main_hidHouseId").val();
        if (!this.changeConfirmWin) {
            this.changeConfirmWin = new Chenxin.UI.ChangeConfirmationForm({
                currentId: this.currentId,
                scope: this,
                afterGetFormJson: function(json) {
                    delete json.AddPerson
                    delete json.AddDepart
                    delete json.Address;
                    delete json.nowStatus;
                    if (this.changeConfirmWin.requestUser) {
                        json.RequestUserId = this.changeConfirmWin.requestUser.UserId;
                        json.RequestDepartId = this.changeConfirmWin.requestUser.DepartId;
                        json.RequestUserCode = this.changeConfirmWin.requestUser.UserCode;
                    }
                    if (json.ChangeType == '10') {//状态变更，无需传递此参数
                        if (json.RequestDepartId) {
                            delete json.RequestDepartId;
                        }
                        if (json.RequestUserId) {
                            delete json.RequestUserId;
                        }
                        if (json.RequestDepart) {
                            delete json.RequestDepart;
                        }
                        if (json.RequestUser) {
                            delete json.RequestUser;
                        }
                        if (json.RequestUserCode) {
                            delete json.RequestUserCode;
                        }
                    } else if (json.ChangeType == '20') {//人员变更，无需传递此参数	
                        if (json.HouseStatus) {
                            delete json.HouseStatus;
                        }
                    }
                    json.Mobile = json.request_customerMoblie;
                    json.Phone = json.request_customerPhone;
                    json.CustomerName = json.request_customerName;
                    delete json.request_customerName
                    delete json.request_customerPhone
                    delete json.request_customerMoblie
                    json.HouseId = _this.currentId;
                }
            });
        }

        if (this.changeConfirmWin.show()) {
            this.changeConfirmWin.setTitle('请求变更');
            var _data = {};
            _data.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            _data.Remarks = '';
            var temp = $("#ctl00_main_hidStatus").val();
            if (temp == 10)
                temp = '有效';
            else if (temp == 20)
                temp = '暂缓';
            else if (temp == -1)
                temp = '无效';
            else if (temp == 30)
                temp = '封盘';
            else
                temp = '';
            _data.nowStatus = temp;
            this.changeConfirmWin.fitData(_data);
            $("#request_tr1").show();
            $("#request_tr2").hide();
            $("#request_tr3").hide();
            $("#request_tr4").hide();
            $("#request_tr5").hide();
            $("#request_tr6").hide();
            $("#request_tr7").hide();
            _this.currentHouseInfo = {};

            //_this.currentHouseInfo.nowStatus = $("#ctl00_main_hidStatus").val();
            _this.currentHouseInfo.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _this.currentHouseInfo.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _this.currentHouseInfo.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _this.currentHouseInfo.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            _this.currentHouseInfo.Status = $("#ctl00_main_hidStatus").val();
            _this.currentHouseInfo.OprPersonId = $("#ctl00_main_hidPersonId").val();

            this.changeConfirmWin.currentId = this.currentId;
        }
    },
    /**
    *@description 房源跟单
    */
    showTraceWin: function() {
        var _this = this;
        if (!this.traceWin) {
            this.traceWin = new Chenxin.UI.TraceForm({
                alwaysCheckPermit: true,
                afterGetFormJson: function(json) {
                    delete json.AddPerson;
                    delete json.AddDepart;
                    json.HouseAddress = json.Address;
                    json.HouseId = $("#ctl00_main_hidHouseId").val();
                    delete json.Address;
                    if (json.isnotice) {
                        this.additionalParam.noticemodel = {
                            body: json.body,
                            NoticeTime: json.SendDate,
                            HouseId: $("#ctl00_main_hidHouseId").val(),
                            HouseAddress: $("#ctl00_main_hidcbrAddress").val()
                        };
                        delete json.body;
                        delete json.SendDate;
                    } else {
                        this.additionalParam = {};
                    }
                    this.additionalParam.isnotice = json.isnotice || '0';
                    delete json.isnotice;
                }
            });
        }
        if (this.traceWin.show()) {
            $('#tr_noticetime').hide();
            $('#tr_noticecontent').hide();
            var _data = {};
            _data.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            this.traceWin.fitData(_data);
            this.traceWin.setTitle('房源跟单');
        }
    },
    /**
    *@description 客源跟单
    */
    showCustomerTraceWin: function() {
        var _this = this;
        if (!this.CustomerTrace) {
            this.CustomerTrace = new Chenxin.UI.CustomerTraceForm({
                scrop: _this,
                afterGetFormJson: function(json) {
                    delete json.AddPerson;
                    delete json.AddDepart;
                    json.HouseAddress = json.Address;
                    json.HouseId = $("#ctl00_main_hidHouseId").val();
                    json.status = 1;
                    delete json.Address;
                    delete json.CustomerCode;

                    if (this.isNotice) {
                        this.additionalParam.noticemodel = {
                            body: json.body,
                            NoticeTime: json.SendDate,
                            HouseId: $("#ctl00_main_hidHouseId").val(),
                            HouseAddress: $("#ctl00_main_hidcbrAddress").val()
                        };
                        delete json.body;
                        delete json.SendDate;
                    } else {
                        this.additionalParam = {};
                    }
                    this.additionalParam.isnotice = json.isnotice || '0';
                    delete json.isnotice;
                }
            });
        }
        this.CustomerTrace.show();
        $('#tr_noticetime').hide();
        $('#tr_noticecontent').hide();
        var _data = {};
        _data.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
        _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
        _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
        _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
        this.CustomerTrace.fitData(_data);
        this.CustomerTrace.setTitle('客源跟单');
    },
    /**
    *@description 房源备案
    */
    showRecordWin: function() {
        var _this = this;

        if (!this.recordWin) {
            this.recordWin = new Chenxin.UI.RecordForm({
                currentId: $("#ctl00_main_hidHouseId").val(),
                alwaysCheckPermit: true,
                afterGetFormJson: function(json) {
                    delete json.AddPerson;
                    delete json.AddDepart;
                    json.HouseAddress = json.Address;
                    delete json.Address;
                    delete json.HouseCode;
                    json.HouseId = $("#ctl00_main_hidHouseId").val();
                }
            });
        }
        if (this.recordWin.show(_this.op, { model: this.modelInfo })) {
            var _data = {};
            _data.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            _data.MarkCode = '';
            this.recordWin.fitData(_data);
            this.recordWin.setTitle('添加备案');
            this.recordWin.currentId = $("#ctl00_main_hidHouseId").val();
        }

    },
    /**
    *@description 任务分配
    */
    showTaskWin: function() {
        var _this = this;
        if (!this.taskWin) {
            this.taskWin = new Chenxin.UI.TaskForm({
                afterGetFormJson: function(json) {
                    json.relatedId = $("#ctl00_main_hidHouseId").val(); //房源ID
                    //json.ReceiverDepart = json.ReceiverDepartId;//任务接收人部门
                }
            });
        }
        if (this.taskWin.show(_this.op, { model: this.modelInfo })) {
            var _data = {};
            _data.relatedCaption = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _data.relatedCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            this.taskWin.fitData(_data);
        }

    },
    /**
    *@description 房源封盘
    */
    showAdjournWin: function() {
        var _this = this;
        if (!this.adjournWin) {
            this.adjournWin = new Chenxin.UI.AdjournForm({
                currentId: $("#ctl00_main_hidHouseId").val(),
                alwaysCheckPermit: true,
                afterGetFormJson: function(json) {
                    if (this.op == 'add') {
                        json.HouseId = $("#ctl00_main_hidHouseId").val();
                        this.additionalParam.workcode = json.workcode;
                        delete json.workcode;
                        delete json.Asker;
                        delete json.AskerDepart;
                        delete json.AddPerson;
                        delete json.AddDepart;
                        json.HouseAddress = json.Address;
                        delete json.Address;
                    } else {
                        Chenxin.apply(json, this.currentModel);
                        this.additionalParam = {};
                    }
                }
            });
        }
        if (this.adjournWin.show(_this.op, { model: this.modelInfo })) {
            var _data = {};
            _data.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            this.adjournWin.fitData(_data);
            this.adjournWin.setTitle('房源封盘');
            if ($("#ctl00_main_hidStatus").val().Status == 30) {//已经封盘，执行解盘			
                alert("此房源已经封盘！");
            }

            this.adjournWin.currentId = $("#ctl00_main_hidHouseId").val();
        }
    },
    /**
    *@description 添加/移除对比
    */
    addcompareHouse: function(op) {
        var message = '';
        if (op == 'add') {
            message = '确定要添加对比吗？';
        } else {
            message = '确定要删除对比吗？';
        }
        if (!confirm(message)) {
            return;
        }

        if ($("#ctl00_main_hidHouseId").val()) {
            var data = {
                op: op || 'add',
                houseid: $("#ctl00_main_hidHouseId").val()
            }
            Chenxin.ajax({
                type: "get",
                url: "service/compareHouse.ashx",
                data: data,
                dataType: "json",
                onSuccess: function(data, msg) {
                    alert(msg);
                }
            });
        } else {
            alert('Error！');
        }
    },
    /**
    *@description 加入收藏
    */
    addfavors: function() {
        if ($("#ctl00_main_hidHouseId").val()) {
            Chenxin.ajax({
                type: "get",
                url: "service/favorite.ashx",
                data: "op=add&favortype=0&houseid=" + $("#ctl00_main_hidHouseId").val() + "&houseaddress=" + encodeURIComponent($("#ctl00_main_hidcbrAddress").val()),
                dataType: "text",
                onSuccess: function(data, msg) {
                    alert(msg);
                }
            });

        } else {
            alert('Error！');
        }
    },
    /**
    *@description 电话保护
    */
    showProtectionWin: function() {
        var _this = this;
        if (!this.protectionWin) {
            this.protectionWin = new Chenxin.UI.ProtectionForm({
                currentId: $("#ctl00_main_hidHouseId").val(),
                alwaysCheckPermit: true,
                afterGetFormJson: function(json) {
                    delete json.HouseCode;
                    delete json.Address;
                    delete json.AddPerson;
                    delete json.AddDepart;
                    json.HouseId = $("#ctl00_main_hidHouseId").val();

                }
            });
        }
        this.protectionWin.op = 'protection';
        if (this.protectionWin.show(_this.op, { model: this.modelInfo })) {
            var _data = {};
            _data.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            this.protectionWin.fitData(_data);
            this.protectionWin.setTitle('电话保护');
            this.protectionWin.currentId = $("#ctl00_main_hidHouseId").val();
        }
    },
    /**
    *@description 取消保护
    */
    unProtection: function() {
        this.currentId = $("#ctl00_main_hidHouseId").val(); //房源ID
        this.del('unprotection', '确定取消这条房源记录的电话保护吗？', "service/protectPhoneHandler.ashx");
    },
    /**
    *@description 添加钥匙
    */
    showKeyWin: function() {

        var _this = this;

        if (!this.keyWin) {
            this.keyWin = new Chenxin.UI.KeyForm({
                currentId: $("#ctl00_main_hidHouseId").val(),
                alwaysCheckPermit: true,
                afterGetFormJson: function(json) {
                    delete json.AddPerson;
                    delete json.AddDepart;
                    json.HouseAddress = json.Address;
                    delete json.Address;
                    json.HouseId = $("#ctl00_main_hidHouseId").val();
                }
            });
        }
        if (this.keyWin.show(_this.op, { model: this.modelInfo })) {
            var _data = {};
            _data.Address = $("#ctl00_main_hidcbrAddress").val(); //小区地址
            _data.HouseCode = $("#ctl00_main_hidHouseCode").val(); //房源编号
            _data.AddPerson = $("#ctl00_main_lbBroker").text(); //所属人
            _data.AddDepart = $("#ctl00_main_lbBrokerDepartNm").text(); //所属部门
            this.keyWin.fitData(_data);
            this.keyWin.setTitle('添加钥匙');
            this.keyWin.currentId = $("#ctl00_main_hidHouseId").val();
        }
    },

    /**
    *@房源图上传——填充图片预览
    */
    FillHousePic: function(houseid) {
        for (i = 0; i < $('input[name="cbxPicId"]').length; i++) {
            $('input[name="cbxPicId"]')[i].checked = false;
            $('input[name="cbxPicId"]')[i].value = "";
        }
        $("#img_house_1").attr("src", "images/noimage.gif");
        $('#img_house_2').attr("src", "images/noimage.gif");
        $('#img_house_3').attr("src", "images/noimage.gif");
        $('#img_inside_1').attr("src", "images/noimage.gif");
        $('#img_inside_2').attr("src", "images/noimage.gif");
        $('#img_inside_3').attr("src", "images/noimage.gif");
        $('#img_outside_1').attr("src", "images/noimage.gif");
        $('#img_outside_2').attr("src", "images/noimage.gif");
        $('#img_outside_3').attr("src", "images/noimage.gif");
        Chenxin.ajax({
            type: "post",
            dataType: "json",
            url: "service/UploadHousePic.ashx?GetAllPic=" + houseid,
            onSuccess: function(data) {
                for (var i = 0; i < data.rows.length; i++) {
                    if (data.rows[i].PicType == "房型图") {
                        if ($("#img_house_1").attr("src") == "images/noimage.gif") {
                            $("#img_house_1").attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_house_1').val(data.rows[i].RecordId);
                        }
                        else if ($('#img_house_2').attr("src") == "images/noimage.gif") {
                            $('#img_house_2').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_house_2').val(data.rows[i].RecordId);
                        }
                        else if ($('#img_house_3').attr("src") == "images/noimage.gif") {
                            $('#img_house_3').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_house_3').val(data.rows[i].RecordId);
                        }
                    }
                    else if (data.rows[i].PicType == "室内图") {
                        if ($('#img_inside_1').attr("src") == "images/noimage.gif") {
                            $('#img_inside_1').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_inside_1').val(data.rows[i].RecordId);
                        }
                        else if ($('#img_inside_2').attr("src") == "images/noimage.gif") {
                            $('#img_inside_2').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_inside_2').val(data.rows[i].RecordId);
                        }
                        else if ($('#img_inside_3').attr("src") == "images/noimage.gif") {
                            $('#img_inside_3').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_inside_3').val(data.rows[i].RecordId);
                        }
                    }
                    else if (data.rows[i].PicType == "室外图") {
                        if ($('#img_outside_1').attr("src") == "images/noimage.gif") {
                            $('#img_outside_1').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_outside_1').val(data.rows[i].RecordId);
                        }
                        else if ($('#img_outside_2').attr("src") == "images/noimage.gif") {
                            $('#img_outside_2').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_outside_2').val(data.rows[i].RecordId);
                        }
                        else if ($('#img_outside_3').attr("src") == "images/noimage.gif") {
                            $('#img_outside_3').attr("src", data.rows[i].ThumbnailUrl);
                            $('#cbx_outside_3').val(data.rows[i].RecordId);
                        }
                    }
                }
            }
        });
    },

    /**
    *@房源图上传
    */
    showUploadHousePic: function() {
        if (!this.showUploadHousePicWin) {
            var _this = this;
            this.showUploadHousePicWin = new Chenxin.UI.UploadHousePicWin({
                scope: this,
                title: "上传房源图片"
            });
         _this.currentHouseInfo = {};
        _this.currentHouseInfo.HouseId = $("#ctl00_main_hidHouseId").val(); //房源id
        _this.currentHouseInfo.CommunityId= $("#ctl00_main_hidCommunityId").val(); //小区id
        _this.currentHouseInfo.OprPersonId = $("#ctl00_main_hidPersonId").val(); //房源所有人id
        }
   
//        this.communityId = $("#ctl00_main_hidCommunity").val();
//        this.currentId = $("#ctl00_main_hidHouseId").val();
//        this.communityId = $("#ctl00_main_hidCommunity").val();
        if (this.showUploadHousePicWin.show()) {
            this.FillHousePic(this.currentId);
        }
    },

    initComponent: function() {
        Chenxin.UI.ShowInfo.superclass.initComponent.call(this);
    }
});

$(document).ready(function() {
    $('#container-1 > ul').tabs();
    this.ShowInfo = new Chenxin.UI.ShowInfo();
});